using System;
using UnityEngine;
/// <summary>
/// 日志管理器
/// </summary>
public static partial class HFP
{
    #region Log
    /// <summary>
    /// Log
    /// </summary>
    /// <param name="_message">信息</param>
#if !UNITY_EDITOR
    [System.Diagnostics.Conditional(HFConditionalMacro.Log)]
#endif
    public static void HFLog(object _message)
    {
        Debug.Log($"[{HFConditionalMacro.Log}]{OnGetPrefix()}{_message}");
    }

    /// <summary>
    /// Log
    /// </summary>
    /// <param name="_message">信息</param>
    /// <param name="_color">颜色</param>
#if !UNITY_EDITOR
    [System.Diagnostics.Conditional(HFConditionalMacro.Log)]
#endif
    public static void HFLog(object _message, Color _color)
    {
        Debug.Log($"{$"[{HFConditionalMacro.Log}]".HFApplyColor(_color)}{OnGetPrefix()}{_message.HFApplyColor(_color)}");
    }

    /// <summary>
    /// Log
    /// </summary>
    /// <param name="_format">格式符</param>
    /// <param name="_args">参数组</param>
#if !UNITY_EDITOR
    [System.Diagnostics.Conditional(HFConditionalMacro.Log)]
#endif
    public static void HFLogFormat(string _format, params object[] _args)
    {
        Debug.LogFormat($"{$"[{HFConditionalMacro.Log}]"}{OnGetPrefix()}{string.Format(_format,_args)}");
    }

    /// <summary>
    /// Log
    /// </summary>
    /// <param name="_format">格式符</param>
    /// <param name="_color">颜色</param>
    /// <param name="_args">参数组</param>
#if !UNITY_EDITOR
    [System.Diagnostics.Conditional(HFConditionalMacro.Log)]
#endif
    public static void HFLogFormat(string _format, Color _color, params object[] _args)
    {
        Debug.LogFormat($"{$"[{HFConditionalMacro.Log.HFApplyColor(_color)}]"}{OnGetPrefix()}{string.Format(_format,_args).HFApplyColor(_color)}");
    }
    #endregion

    #region Warning
    /// <summary>
    /// LogWarning
    /// </summary>
    /// <param name="_message">信息</param>
#if !UNITY_EDITOR
    [System.Diagnostics.Conditional(HFConditionalMacro.Warning)]
#endif
    public static void HFWarning(object _message)
    {
        Debug.LogWarning($"{$"[{HFConditionalMacro.Warning.HFApplyColor(Color.yellow)}]"}{OnGetPrefix()}{_message.HFApplyColor(Color.yellow)}");
    }

    /// <summary>
    /// LogWarning
    /// </summary>
    /// <param name="_message">信息</param>
    /// <param name="_color">颜色</param>
#if !UNITY_EDITOR
    [System.Diagnostics.Conditional(HFConditionalMacro.Warning)]
#endif
    public static void HFWarning(object _message, Color _color)
    {
        Debug.LogWarning($"{$"[{HFConditionalMacro.Warning.HFApplyColor(Color.yellow)}]"}{OnGetPrefix()}{_message.HFApplyColor(_color)}");
    }

    /// <summary>
    /// LogWarning
    /// </summary>
    /// <param name="_format">格式符</param>
    /// <param name="_args">参数组</param>
#if !UNITY_EDITOR
    [System.Diagnostics.Conditional(HFConditionalMacro.Warning)]
#endif
    public static void HFWarningFormat(string _format, params object[] _args)
    {
        Debug.LogWarningFormat($"{$"[{HFConditionalMacro.Warning.HFApplyColor(Color.yellow)}]"}{OnGetPrefix()}{string.Format(_format,_args).HFApplyColor(Color.yellow)}");
    }
    /// <summary>
    /// LogWarning
    /// </summary>
    /// <param name="_format">格式符</param>
    /// <param name="_color">颜色</param>
    /// <param name="_args">参数组</param>
#if !UNITY_EDITOR
    [System.Diagnostics.Conditional(HFConditionalMacro.Warning)]
#endif
    public static void HFWarningFormat(string _format, Color _color, params object[] _args)
    {
        Debug.LogWarningFormat($"{$"[{HFConditionalMacro.Warning.HFApplyColor(_color)}]"}{OnGetPrefix()}{string.Format(_format, _args).HFApplyColor(_color)}");
    }
    #endregion

    #region Error
    /// <summary>
    /// LogError
    /// </summary>
    /// <param name="_message">信息</param>
//#if !UNITY_EDITOR
//    [System.Diagnostics.Conditional(HFConditionalMacro.Error)]
//#endif
    public static void HFError(object _message)
    {
        Debug.LogError($"{$"[{HFConditionalMacro.Error.HFApplyColor(Color.red)}]"}{OnGetPrefix()}{_message.HFApplyColor(Color.red)}");
    }

    /// <summary>
    /// LogError
    /// </summary>
    /// <param name="_message">信息</param>
    /// <param name="_color">颜色</param>
//#if !UNITY_EDITOR
//    [System.Diagnostics.Conditional(HFConditionalMacro.Error)]
//#endif
    public static void HFError(object _message, Color _color)
    {
        Debug.LogError($"{$"[{HFConditionalMacro.Error.HFApplyColor(Color.red)}]"}{OnGetPrefix()}{_message.HFApplyColor(_color)}");
    }

    /// <summary>
    /// LogError
    /// </summary>
    /// <param name="_format">格式符</param>
    /// <param name="_args">参数组</param>
//#if !UNITY_EDITOR
//    [System.Diagnostics.Conditional(HFConditionalMacro.Error)]
//#endif
    public static void HFErrorFormat(string _format, params object[] _args)
    {
        Debug.LogErrorFormat($"{$"[{HFConditionalMacro.Error.HFApplyColor(Color.red)}]"}{OnGetPrefix()}{string.Format(_format, _args).HFApplyColor(Color.red)}");
    }

    /// <summary>
    /// LogError
    /// </summary>
    /// <param name="_format">格式符</param>
    /// <param name="_color">颜色</param>
    /// <param name="_args">参数组</param>
//#if !UNITY_EDITOR
//    [System.Diagnostics.Conditional(HFConditionalMacro.Error)]
//#endif
    public static void HFErrorFormat(string _format, Color _color, params object[] _args)
    {
        Debug.LogErrorFormat($"{$"[{HFConditionalMacro.Error.HFApplyColor(Color.red)}]"}{OnGetPrefix()}{string.Format(_format, _args).HFApplyColor(_color)}");
    }
    #endregion

    #region Exception
    /// <summary>
    /// LogException
    /// </summary>
    /// <param name="_exception">Exception</param>
#if !UNITY_EDITOR
    [System.Diagnostics.Conditional(HFConditionalMacro.Exception)]
#endif
    public static void HFException(Exception _exception)
    {
        Debug.LogException(_exception);
    }
    #endregion

    #region Assertion
    /// <summary>
    /// LogAssertion
    /// </summary>
    /// <param name="_message">信息</param>
#if !UNITY_EDITOR
    [System.Diagnostics.Conditional(HFConditionalMacro.Assertion)]
#endif
    public static void HFAssertion(object _message)
    {
        Debug.LogAssertion($"{$"[{HFConditionalMacro.Assertion.HFApplyColor(Color.magenta)}]"}{OnGetPrefix()}{_message.HFApplyColor(Color.magenta).HFApplyItalic()}");
    }

    /// <summary>
    /// LogAssertion
    /// </summary>
    /// <param name="_message">信息</param>
    /// <param name="_color">颜色</param>
#if !UNITY_EDITOR
    [System.Diagnostics.Conditional(HFConditionalMacro.Assertion)]
#endif
    public static void HFAssertion(object _message, Color _color)
    {
        Debug.LogAssertion($"{$"[{HFConditionalMacro.Assertion.HFApplyColor(Color.magenta)}]"}{OnGetPrefix()}{_message.HFApplyColor(_color).HFApplyColor(Color.magenta).HFApplyItalic()}");
    }

    /// <summary>
    /// LogAssertionFormat
    /// </summary>
    /// <param name="_format">格式符</param>
    /// <param name="_args">参数组</param>
#if !UNITY_EDITOR
    [System.Diagnostics.Conditional(HFConditionalMacro.Assertion)]
#endif
    public static void HFAssertionFormat(string _format, params object[] _args)
    {
        Debug.LogAssertionFormat($"{$"[{HFConditionalMacro.Assertion.HFApplyColor(Color.magenta)}]"}{OnGetPrefix()}{string.Format(_format, _args).HFApplyColor(Color.magenta).HFApplyItalic()}");
    }

    /// <summary>
    /// LogAssertionFormat
    /// </summary>
    /// <param name="_format">格式符</param>
    /// <param name="_color">颜色</param>
    /// <param name="_args">参数组</param>
#if !UNITY_EDITOR
    [System.Diagnostics.Conditional(HFConditionalMacro.Assertion)]
#endif
    public static void HFAssertionFormat(string _format, Color _color, params object[] _args)
    {
        Debug.LogAssertionFormat($"{$"[{HFConditionalMacro.Assertion.HFApplyColor(Color.magenta)}]"}{OnGetPrefix()}{string.Format(_format, _args).HFApplyColor(_color).HFApplyItalic()}");
    }
    #endregion
}